package com.jzd1997.lesson2;

import org.apache.commons.lang.math.NumberUtils;

public class CashReturn extends CashSuper {
    private double  numCondition = 0d;
    private double numReturn = 0d;

    public CashReturn(String numCondition,String numReturn){
        this.numCondition = NumberUtils.toDouble(numCondition);
        this.numReturn = NumberUtils.toDouble(numReturn);
    }

    @Override
    public double acceptCash(double money) {
        if(numCondition==0){
            return money;
        }else{
            return money-((int)(money/numCondition))*numReturn;
        }
    }

}
